function resetForm(formId) {
	var idElement = formId;
	if (formId.charAt(0) == "#") {
		idElement = id.substring(1, formId.length);
	}
	
	if ($("[id*='"+idElement+"']").length > 0) {
		$("[id$='"+idElement+"']").children().each(function(){
			resetOneElement(this);
		});
		

	}
}
function resetOneElement(object){
	var $object = $(object);
	if(!xexpCheckObjectExists(object)){return;}
	if ($object.hasClass("ui-autocomplete-multiple")) {
		$object.find("ul").first().removeClass("ui-state-error");
	} else if ($object.hasClass("ui-autocomplete")) {
		$object.find("input").first().removeClass("ui-state-error");

	} else if ($object.hasClass("ui-selectmanycheckbox")) {
		$object.find("div").each(function() {
			if ($(this).hasClass("ui-chkbox-box")) {
				$(this).removeClass("ui-state-error");
			}
		});
	} else if ($object.hasClass("ui-selectoneradio")) {
		$object.find("div").each(function() {
			if ($(this).hasClass("ui-radiobutton-box")) {
				$(this).removeClass("ui-state-error");
			}
		});
	} else {
		if ($object.find("input").first().length > 0) {			
			$object.find("input").first()
					.removeClass("ui-state-error");
		} else {				
			$object.removeClass("ui-state-error");
			
		}
		$object.find("input")
		.removeClass("ui-state-error");
	}
	
	// set error message
	if ($object.find(".ui-message-error").length > 0) {
		// //alert(id_error);
		$object.find(".ui-message-error").each(function(){
			$(this).removeClass();
			$(this).html("");
		});
		
	}
}

/**
 * check object is existed or not
 * @param obj
 * @returns {Boolean}
 */
function xexpCheckObjectExists(obj){
	if(obj == null || typeof(obj) == 'undefined' || obj.length == 0) {
		return false;
	} else {
		return true;
	}
}